package com.hliushi.mp.injectors;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;

/**
 * @ClassName QueryAll
 * @Description 查询所有 | AbstractMethod --> 抽象的注入方法类
 * @Author hliushi
 * @Date 2021/8/31 9:20
 * @Version V1.0
 **/
public class QueryAll extends AbstractMethod {
    @Override
    public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
        String sql = "select * from " + tableInfo.getTableName();
        SqlSource sqlSource = super.languageDriver.createSqlSource(super.configuration, sql, modelClass);
        return this.addSelectMappedStatementForTable(mapperClass, "queryAll", sqlSource, tableInfo);
    }
}
